<?php
namespace PsiFramework\Classes\Util\Parameters\Action;

import("Classes.Util.Parameters.Action.ActionForward");

use \PsiFramework\Classes\Util\Parameters\Action\ActionForward;

/**
 * PsiFramework
 * Php Simple Framework
 *
 * @author Rémi San
 * @version beta
 */

/**
 * The ActionParameters class is the class to manage action parameters
 *
 * @package Util.Parameters.Action
 */
class ActionParameters
{

    protected /*string*/          $_name ;
    protected /*string*/          $_class ;
    protected /*ActionForward[]*/ $_forwards ;
    protected /*string*/          $_template ;

    public function __construct(
        /*string*/ $name=null,
        /*string*/ $class=null,
        /*ActionForward[]*/ $forwards=null,
        /*string*/ $template='layout'
    )
    {
        $this->_name = $name ;
        $this->_class = $class ;
        $this->_forwards = $forwards ;
        $this->_template = $template ;
    }

    public function getName()
    {
        return $this->_name ;
    }

    public function getClass()
    {
        return $this->_class ;
    }

    public function getForwards()
    {
        return $this->_forwards ;
    }

    public function getTemplate()
    {
        return $this->_template ;
    }

    public function getForward(/*string*/ $name)
    {
        if (!isset($this->_forwards[$name])) {
            return null ;
        } else {
            return $this->_forwards[$name] ;
        }
    }

    public function setName(/*string*/ $name)
    {
        $this->_name = $name ;
    }

    public function setClass(/*string*/ $class)
    {
        $this->_class = $class ;
    }

    public function setForwards(/*ActionForward[]*/ $forwards)
    {
        $this->_forwards = $forwards ;
    }

    public function addForward(ActionForward $forward)
    {
        $this->_forwards[$forward->getName()] = $forward ;
    }

    public function setTemplate(/*string*/ $template)
    {
        $this->_template = $template ;
    }
}
